﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.ComponentModel;

namespace EntModApp.EntServices.Presentation
{
  public static class GlobalSynchronizationContext
  {
    private static SynchronizationContext _Current;
    public static SynchronizationContext Current
    {
      get
      {
        return _Current ?? AsyncOperationManager.SynchronizationContext;
      }
    }

    public static void SetCurrent(SynchronizationContext _Current_)
    {
      if (_Current_ == null) throw new ArgumentNullException("_Current_");
      if (_Current != null) throw new InvalidOperationException("Can set only one SynchronizationContext");

      _Current = _Current_;
    }
  }
}
